package com.ccz.demo.design.chain.a;

import com.alibaba.fastjson.JSON;
import com.ccz.demo.design.chain.EnableFilter;
import com.ccz.demo.design.chain.Filter;
import com.ccz.demo.design.chain.FilterChain;
import com.ccz.demo.design.chain.Rule;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@EnableFilter
public class LevelTwoFilter implements Filter {

    @Override
    public void execute(Rule rule, FilterChain chain) {
        log.info("触发级别二的规则：{}", JSON.toJSONString(rule));
        rule.setLevel(1000);
        // 回调
        chain.doFilter(rule, chain);
    }
}
